package com.hsh.maoduo.controller;

import com.hsh.maoduo.common.Result;
import com.hsh.maoduo.service.YDService;
import com.hsh.maoduo.service.YTGJService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/yd")
public class YDController {
    @Resource(name = "YDServiceImpl")
    private YDService YDService;

    @Resource
    private YTGJService YTGJService;

    /**
     * 生成韵达导入文件
     *
     * @param jdPassword
     * @param mtPassword
     * @return
     */
    @GetMapping("/writeImportExcel")
    public Result writeImportExcel(String jdPassword, String mtPassword) {
        int jdNum = YDService.writeImportExcel(jdPassword);
        int mtNum = YTGJService.writeImportExcel(mtPassword);
        return Result.success("京东导入数量：" + jdNum + "<br>-----------------------------<br>美团导入数量：" + mtNum);
//        return Result.success("京东导入数量：" + jdNum);
    }

    /**
     * 生成韵达揽收文件
     *
     * @param dateStr
     * @return
     */
    @GetMapping("/writeSendExcel")
    public Result writeSendExcel(String dateStr) {
        return YDService.writeSendExcel(dateStr);
    }
}
